package com.huashi.dealer.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 通用排序枚举
 */
@Getter
@AllArgsConstructor
public enum CommonSortOrderEnum {

    ASC("asc", "升序"),
    DESC("desc", "降序");

    private final String value;
    private final String description;

    /**
     * 验证排序方式
     */
    public static void validate(String sortOrder) {
        for (CommonSortOrderEnum orderEnum : values()) {
            if (orderEnum.getValue().equals(sortOrder)) {
                return;
            }
        }
        throw new IllegalArgumentException("无效的排序方式: " + sortOrder);
    }
} 